package test2;

import java.io.*;
import java.util.Scanner;

public class UtilAPi {
    //两个方法
    public  static byte[] getByteArray(InputStream inputStream) throws IOException {
        byte[]b = new byte[4096];
        int n = 0;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        while ((n = inputStream.read(b)) != -1){
            baos.write(b,0,n);
        }
        byte[]array = baos.toByteArray();
        baos.close();
        return array;
    }
        public static String streamToString(BufferedReader is) throws Exception {
            StringBuilder stringBuilder = new StringBuilder();
            String line;

            while ((line = is.readLine()) != null) {
                stringBuilder.append(line);
            }

            String content = stringBuilder.toString();
            return content;

    }
}
